Skip to content

fix: use branding colors in charts#51

Merged
tac0turtle merged 2 commits intomainfrom
pthmas/fix-graph-theme-colors
Apr 7, 2026
Merged

fix: use branding colors in charts#51
tac0turtle merged 2 commits intomainfrom
pthmas/fix-graph-theme-colors

Conversation

@pthmas
Copy link
Copy Markdown
Collaborator

@pthmas pthmas commented Apr 2, 2026

Summary

  • source chart accent colors from the active branding config instead of hard-coded values
  • use theme-aware surface and text tokens for chart grids, axes, and tooltips
  • apply the shared chart color hook to the status and token detail pages

Summary by CodeRabbit

  • New Features
    • Charts now dynamically adapt their colors based on branding accent color configuration, allowing for improved visual consistency across the application.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 2, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 0c79b0ff-ccb7-4a44-ad3c-acdd7ac90ea7

📥 Commits

Reviewing files that changed from the base of the PR and between 2f15e33 and 9aa3480.

📒 Files selected for processing (1)
  • frontend/src/context/branding.ts

📝 Walkthrough

Walkthrough

This PR extends the branding context with customizable chart accent color support. A new useChartColors hook provides memoized chart color tokens derived from branding and theme contexts, replacing hardcoded values in chart components.

Changes

Cohort / File(s) Summary
Branding Infrastructure
frontend/src/context/branding-context.ts, frontend/src/context/branding.ts
Extended BrandingContextValue interface with optional accentHex: string | null field; updated brandingDefaults and resolveBrandingValue() to derive accent color from config.
Chart Color Hook
frontend/src/hooks/useChartColors.ts
Added new useChartColors() hook that reads accentHex from BrandingContext and theme from ThemeContext, returning memoized chart color tokens (accent, grid, axisText, tooltipBg, tooltipText).
Chart Components
frontend/src/pages/StatusPage.tsx, frontend/src/pages/TokenDetailPage.tsx
Replaced hardcoded chart color constants with useChartColors() hook; updated tooltip itemStyle.color from static '#f8fafc' to hook-provided tooltipText color.

Sequence Diagram

sequenceDiagram
    participant Comp as Chart Component<br/>(StatusPage/TokenDetailPage)
    participant Hook as useChartColors Hook
    participant BrandCtx as BrandingContext
    participant ThemeCtx as ThemeContext
    participant CSS as CSS Variables<br/>(getComputedStyle)
    
    Comp->>Hook: invoke useChartColors()
    Hook->>BrandCtx: read accentHex
    Hook->>ThemeCtx: read theme (default 'dark')
    Hook->>CSS: getComputedStyle(documentElement)
    CSS-->>Hook: grid, axisText, tooltipBg, tooltipText values
    Hook-->>Comp: {accent, grid, axisText, tooltipBg, tooltipText}
    Comp->>Comp: apply colors to Recharts components
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • tac0turtle

Poem

🐰 A colorful garden of charts takes shape,
With accent hues crafted from config's cape,
No hardcoding now—just hooks and a theme,
Making dashboards shimmer in every bright beam! ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'fix: use branding colors in charts' directly summarizes the main change: sourcing chart colors from branding config instead of hardcoded values, which aligns perfectly with the PR objectives.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch pthmas/fix-graph-theme-colors

Warning

Review ran into problems

🔥 Problems

Git: Failed to clone repository. Please run the @coderabbitai full review command to re-trigger a full review. If the issue persists, set path_filters to include or exclude specific files.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@pthmas pthmas self-assigned this Apr 2, 2026
@tac0turtle tac0turtle merged commit 7fd9b9b into main Apr 7, 2026
10 checks passed
@tac0turtle tac0turtle deleted the pthmas/fix-graph-theme-colors branch April 7, 2026 09:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants